package com.approval.approvalapp.center.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.approval.approvalapp.R;
import com.approval.approvalapp.center.bean.ConsultCensusBean;
import com.approval.approvalapp.center.bean.MonthCommentBean;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * @author superman
 * @date 2019/5/9
 */
public class ConsultCensusAdapter extends BaseRecycleListAdapter<ConsultCensusBean> {


    public ConsultCensusAdapter(List<ConsultCensusBean> mList, Context context) {
        super(mList, context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.consult_census_item;
    }

    @Override
    public RecyclerView.ViewHolder createHolder(View view) {
        return new ViewHolder(view);
    }

    @Override
    protected void onBindDefaultViewHolder(RecyclerView.ViewHolder holder, ConsultCensusBean bean, int position) {
        if(holder instanceof  ViewHolder){
            ((ViewHolder) holder).setData(bean,position);
        }
    }

    public class ViewHolder extends RecyclerView.ViewHolder{
        @Bind(R.id.tv_name1)
        TextView tvName1;
        @Bind(R.id.tv_name2)
        TextView tvName2;
        @Bind(R.id.tv_name3)
        TextView tvName3;
        @Bind(R.id.tv_name4)
        TextView tvName4;
        @Bind(R.id.tv_name5)
        TextView tvName5;
        @Bind(R.id.tv_name6)
        TextView tvName6;
        @Bind(R.id.tv_name7)
        TextView tvName7;
        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }


        public void setData(ConsultCensusBean bean, int position) {

            String name = bean.getName();
            ConsultCensusBean.SjBean beanSj = bean.getSj();



            tvName1.setText(name);
            tvName2.setText(beanSj.getAll());
            tvName3.setText(beanSj.getTs_all() + "");
            tvName4.setText(beanSj.getAlready() + "");
            tvName5.setText(beanSj.getTs_already() +"");
            tvName6.setText(beanSj.getPending());
            tvName7.setText(beanSj.getTs_pending());

        }
    }
}
